package day13.KeJian;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class CharStreamDemo8 {
    /*- 案例需求

  将键盘录入的用户名和密码保存到本地实现永久化存储

- 实现步骤

  - 获取用户输入的用户名和密码
  - 将用户输入的用户名和密码写入到本地文件中
  - 关流,释放资源*/
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入账户:");
        String s1 = sc.next();
        System.out.println("请输入密码:");
        String s2 = sc.next();
        FileWriter fw = new FileWriter("D://itheima//nb.txt");
        fw.write(s1);
        fw.write("\r\n");
        fw.write(s2);
        fw.flush();
        fw.close();
    }
}
